package com.dm.service;

import com.dm.dao.DmBaseeAreaMapper;
import com.dm.pojo.DmBaseeArea;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Created by dm
 */
@RestController
public class RestDmBaseeAreaService {

     @Autowired
     private DmBaseeAreaMapper dmBaseeAreaMapper;

     @RequestMapping(value = "/getDmBaseeAreaById",method = RequestMethod.POST)
     public DmBaseeArea getDmBaseeAreaById(@RequestParam("id") Long id)throws Exception{
        return dmBaseeAreaMapper.getDmBaseeAreaById(id);
     }

     @RequestMapping(value = "/getDmBaseeAreaListByMap",method = RequestMethod.POST)
     public List<DmBaseeArea>	getDmBaseeAreaListByMap(@RequestParam Map<String,Object> param)throws Exception{
        return dmBaseeAreaMapper.getDmBaseeAreaListByMap(param);
     }

     @RequestMapping(value = "/getDmBaseeAreaCountByMap",method = RequestMethod.POST)
     public Integer getDmBaseeAreaCountByMap(@RequestParam Map<String,Object> param)throws Exception{
        return dmBaseeAreaMapper.getDmBaseeAreaCountByMap(param);
     }

     @RequestMapping(value = "/qdtxAddDmBaseeArea",method = RequestMethod.POST)
     public Integer qdtxAddDmBaseeArea(@RequestBody DmBaseeArea dmBaseeArea)throws Exception{
        dmBaseeArea.setCreatedTime(new Date());
        return dmBaseeAreaMapper.insertDmBaseeArea(dmBaseeArea);
     }

     @RequestMapping(value = "/qdtxModifyDmBaseeArea",method = RequestMethod.POST)
     public Integer qdtxModifyDmBaseeArea(@RequestBody DmBaseeArea dmBaseeArea)throws Exception{
        dmBaseeArea.setUpdatedTime(new Date());
        return dmBaseeAreaMapper.updateDmBaseeArea(dmBaseeArea);
     }
}
